- /* snmcutdn.cpp by K.Tsuru */
- //function ID=106,107
- /**********************************************
- SNumber class
- CutDown()
- It reduces size by removing unnecessary zeros.
- ***********************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
- // DETECT_IR = 3 in SNManager class
- bool SNumber::cutDownTable[SNManager::DETECT_IR] = {DISABLE, ENABLE, ENABLE};
-
- // function ID = 106
- void SNumber::CutDown(uchar cd) {
- if(type == BIN_DEC) return; // SDecimal always DISABLE.
- int tp = type & DETECT_IR;
- #ifndef NDEBUG
- assert(tp);
- #endif
- if(cd == POP){
- if(pushCD & PUSH){
- pushCD &= ~PUSH;
- cutDownTable[tp] = (cutDownTable[tp] == ENABLE) ? DISABLE : ENABLE;
- }
- } else { // here cd == DISABLE (false) or ENABLE(true)
- // if( cd != (cutDownTable[tp]){
- uchar temp = cutDownTable[tp] ? 1u : 0; // for the warning by visual c++ since ver 2.19
- if( cd != temp){
- cutDownTable[tp] = (cutDownTable[tp] == ENABLE) ? DISABLE : ENABLE;
- pushCD |= PUSH;
- }
- }
- }
- // function ID = 107
- //It removes unnecessary zeros.
- //necessary size = aHead+1
- void SNumber::DoCutDown(){
- if(CutDown() == DISABLE) return;
- if( figure.size() <= minArraySize ) return; //cannot reduce size
- if( 2u*(aHead+1) <= figure.size() ) valloc( aHead+1, 1);
- }
snmcutdn.cpp : last modifiled at 2016/09/04 14:21:43(1,289 bytes)
created at 2016/04/11 11:36:47
The creation time of this html file is 2017/10/27 10:59:17 (Fri Oct 27 10:59:17 2017).